﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace MidSoft.Web.Model_T_PET_OPINION
{
    public partial class Modify : Page
    {       

        		protected void Page_Load(object sender, EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				#warning 代码生成提示：显示页面,请检查确认该语句是否正确
				ShowInfo();
			}
		}
			
	private void ShowInfo()
	{
		MidSoft.BLL.BLL_T_PET_OPINION bll=new MidSoft.BLL.BLL_T_PET_OPINION();
		MidSoft.Model.Model_T_PET_OPINION model=bll.GetModel();
		this.txtPET_OPINION_ID.Text=model.PET_OPINION_ID;
		this.txtCOM_OPINION.Text=model.COM_OPINION;
		this.txtDEP_OPINION.Text=model.DEP_OPINION;
		this.txtNOTE.Text=model.NOTE;
		this.txtPETDEP_OPINION.Text=model.PETDEP_OPINION;
		this.txtPET_ID.Text=model.PET_ID;
		this.txtPOLICE_OPINION.Text=model.POLICE_OPINION;
		this.txtREG_ORG_ID.Text=model.REG_ORG_ID;
		this.txtSHIRONG_OPINION.Text=model.SHIRONG_OPINION;
		this.txtSTREET_OPINION.Text=model.STREET_OPINION;
		this.txtLEADER_OPINION.Text=model.LEADER_OPINION;
		this.txtCREATE_TIME.Text=model.CREATE_TIME.ToString();
		this.txtCREATOR_ID.Text=model.CREATOR_ID;
		this.txtUPDATE_TIME.Text=model.UPDATE_TIME.ToString();
		this.txtUPDATOR_ID.Text=model.UPDATOR_ID;
		this.txtID.Text=model.ID.ToString();

	}

		public void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtPET_OPINION_ID.Text.Trim().Length==0)
			{
				strErr+="ID不能为空！\\n";	
			}
			if(this.txtCOM_OPINION.Text.Trim().Length==0)
			{
				strErr+="公司意见不能为空！\\n";	
			}
			if(this.txtDEP_OPINION.Text.Trim().Length==0)
			{
				strErr+="部门意见不能为空！\\n";	
			}
			if(this.txtNOTE.Text.Trim().Length==0)
			{
				strErr+="备注不能为空！\\n";	
			}
			if(this.txtPETDEP_OPINION.Text.Trim().Length==0)
			{
				strErr+="犬只部门意见不能为空！\\n";	
			}
			if(this.txtPET_ID.Text.Trim().Length==0)
			{
				strErr+="犬只ID不能为空！\\n";	
			}
			if(this.txtPOLICE_OPINION.Text.Trim().Length==0)
			{
				strErr+="派出所意见不能为空！\\n";	
			}
			if(this.txtREG_ORG_ID.Text.Trim().Length==0)
			{
				strErr+="注册组织ID不能为空！\\n";	
			}
			if(this.txtSHIRONG_OPINION.Text.Trim().Length==0)
			{
				strErr+="社区意见不能为空！\\n";	
			}
			if(this.txtSTREET_OPINION.Text.Trim().Length==0)
			{
				strErr+="街道意见不能为空！\\n";	
			}
			if(this.txtLEADER_OPINION.Text.Trim().Length==0)
			{
				strErr+="主管意见不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtCREATE_TIME.Text))
			{
				strErr+="创建时间格式错误！\\n";	
			}
			if(this.txtCREATOR_ID.Text.Trim().Length==0)
			{
				strErr+="创建人ID不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtUPDATE_TIME.Text))
			{
				strErr+="更新时间格式错误！\\n";	
			}
			if(this.txtUPDATOR_ID.Text.Trim().Length==0)
			{
				strErr+="更新人不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtID.Text))
			{
				strErr+="原ID格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			string PET_OPINION_ID=this.txtPET_OPINION_ID.Text;
			string COM_OPINION=this.txtCOM_OPINION.Text;
			string DEP_OPINION=this.txtDEP_OPINION.Text;
			string NOTE=this.txtNOTE.Text;
			string PETDEP_OPINION=this.txtPETDEP_OPINION.Text;
			string PET_ID=this.txtPET_ID.Text;
			string POLICE_OPINION=this.txtPOLICE_OPINION.Text;
			string REG_ORG_ID=this.txtREG_ORG_ID.Text;
			string SHIRONG_OPINION=this.txtSHIRONG_OPINION.Text;
			string STREET_OPINION=this.txtSTREET_OPINION.Text;
			string LEADER_OPINION=this.txtLEADER_OPINION.Text;
			DateTime CREATE_TIME=DateTime.Parse(this.txtCREATE_TIME.Text);
			string CREATOR_ID=this.txtCREATOR_ID.Text;
			DateTime UPDATE_TIME=DateTime.Parse(this.txtUPDATE_TIME.Text);
			string UPDATOR_ID=this.txtUPDATOR_ID.Text;
			decimal ID=decimal.Parse(this.txtID.Text);


			MidSoft.Model.Model_T_PET_OPINION model=new MidSoft.Model.Model_T_PET_OPINION();
			model.PET_OPINION_ID=PET_OPINION_ID;
			model.COM_OPINION=COM_OPINION;
			model.DEP_OPINION=DEP_OPINION;
			model.NOTE=NOTE;
			model.PETDEP_OPINION=PETDEP_OPINION;
			model.PET_ID=PET_ID;
			model.POLICE_OPINION=POLICE_OPINION;
			model.REG_ORG_ID=REG_ORG_ID;
			model.SHIRONG_OPINION=SHIRONG_OPINION;
			model.STREET_OPINION=STREET_OPINION;
			model.LEADER_OPINION=LEADER_OPINION;
			model.CREATE_TIME=CREATE_TIME;
			model.CREATOR_ID=CREATOR_ID;
			model.UPDATE_TIME=UPDATE_TIME;
			model.UPDATOR_ID=UPDATOR_ID;
			model.ID=ID;

			MidSoft.BLL.BLL_T_PET_OPINION bll=new MidSoft.BLL.BLL_T_PET_OPINION();
			bll.Update(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","list.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
